<template>
  <div >
    <el-table
      @sort-change="sortChange"
      :default-sort="sortRule"
      @row-click="clickRow"
      :data="tableData"
      highlight-current-row
      class="effx"
      border
      stripe
      style="width: 100%"
      @selection-change="settableCheckbox" 
      :max-height="tableHeightss"
    >
      <el-table-column v-if="sourceType == 3" :selectable="checkSelectable" type="selection" width="55" key="1"></el-table-column>
      <el-table-column prop="lumImage" label="灯具图" v-if="showcolumn('灯具图',2)" key="2">
        <template slot-scope="scope">
          <img v-show="scope.row.isHzyf==1" src="@/assets/images/12.png" class="jiaoIcon" />
          <img
            :src="ImgPath+scope.row.lumImage"
            alt
            @click.stop="viewPicture(ImgPath+scope.row.lumImage)"
          />
        </template>
      </el-table-column>

    <template v-if="contestTypeStr == 'all' || (contestTypeStr!='控光点光源' && contestTypeStr!='不控光点光源' && contestTypeStr!='远视点光源')">
        <el-table-column prop="pseuColor" label="伪色图" v-if="showcolumn('伪色图',1)" key="3">
          <template slot-scope="scope">
            <img
              :src="ImgPath+scope.row.pseuColor"
              height="66"
              alt
              @click.stop="viewPicture(ImgPath+scope.row.pseuColor)"
            />
          </template>
        </el-table-column>
        <el-table-column prop="viewPhoto" label="效果图" v-if="showcolumn('效果图',1)" key="4">
          <template slot-scope="scope">
            <img v-show="scope.row.dataType==1" src="@/assets/images/11.png" class="jiaoIcon" />
            <img
              :src="ImgPath+scope.row.viewPhoto"
              height="66"
              alt
              @click.stop="viewPicture(ImgPath+scope.row.viewPhoto)"
            />
          </template>
        </el-table-column>
    </template>
      <el-table-column prop="lightIntensity" label="配光曲线图" v-if="showcolumn('配光曲线图',1)" key="5" width="100">
        <template slot-scope="scope">
          <img v-show="scope.row.dataType==1" src="@/assets/images/11.png" class="jiaoIcon" />
          <img
            :src="ImgPath+scope.row.lightIntensity"
            alt
            @click.stop="viewPicture(ImgPath+scope.row.lightIntensity)"
          />
        </template>
      </el-table-column>
      <el-table-column  prop="brandName" label="品牌" v-if="showcolumn('品牌',2)" key="6">
        <template slot-scope="scope">
          <span class="lase">{{scope.row.brandName}}</span>
        </template>
      </el-table-column>
      <el-table-column
      v-if="showcolumn('灯具类型',2)" 
      key="7"
        prop="dictIdLtype"
        label="灯具类型"
        width="100"
      >
        <template slot-scope="scope">{{scope.row.dictIdLtype}}</template>
      </el-table-column>

      <el-table-column
      v-if="showcolumn('实测功率',3)" 
      key="8"
        sortable="custom"
        prop="power"
        label="实测功率"
        width="110"
      >
        <template slot-scope="scope">
          <span v-if="scope.row.power != null && scope.row.power != ''">{{scope.row.power}}W</span>
        </template>
      </el-table-column>

      <el-table-column
      v-if="showcolumn('实测光束角',3)" 
     key="9"
        sortable="custom"
        prop="angle1"
        label="实测光束角"
        width="120"
      >
        <template slot-scope="scope">
          <template
            v-if="scope.row.angle1 != null && scope.row.angle2 != null"
          >{{scope.row.angle1}}° * {{scope.row.angle2}}°</template>
        </template>
      </el-table-column>

      <el-table-column v-if="showcolumn('应用类型',1)" key="10" prop="contestTypeStr" label="应用类型"></el-table-column>
      <el-table-column  key="11" sortable="custom" prop="sH" label="H" v-if="showcolumn('H',1)"  >
        <template slot-scope="scope">
          {{scope.row.sH}}
          <span v-if="scope.row.sH != null">m</span>
        </template>
      </el-table-column>
      <el-table-column v-if="showcolumn('W',1)"  key="12" sortable="custom" prop="sW" label="W">
        <template slot-scope="scope">
          {{scope.row.sW}}
          <span v-if="scope.row.sW != null">m</span>
        </template>
      </el-table-column>
      <el-table-column v-if="showcolumn('W1',1)"  key="13" sortable="custom" prop="sW1" label="W1">
        <template slot-scope="scope">
          {{scope.row.sW1}}
          <span v-if="scope.row.sW1 != null">m</span>
        </template>
      </el-table-column>
      <el-table-column v-if="showcolumn('W2',1)" key="14"  sortable="custom" prop="sW2" label="W2">
        <template slot-scope="scope">
          {{scope.row.sW2}}
          <span v-if="scope.row.sW2 != null">m</span>
        </template>
      </el-table-column>
      <el-table-column
        v-if="showcolumn('D',1)" 
        key="15"
        sortable="custom"
        prop="lumSize"
        label="D"
      >
        <template slot-scope="scope">
          {{scope.row.lumSize}}
          <span v-if="scope.row.lumSize != null">m</span>
        </template>
      </el-table-column>
      <el-table-column
      v-if="showcolumn('测试角度',1)" 
        sortable="custom"
        key="16"
        prop="testAngle"
        label="测试角度"
      >
      
        <template slot-scope="scope">
          {{scope.row.testAngle}}
          <span v-if="scope.row.testAngle != null">°</span>
        </template>
      </el-table-column>
      <el-table-column
        v-if="showcolumn('检测模式',1)" 
        sortable="custom"
        key="17"
        prop="rgbwa"
        label="检测模式"
      ></el-table-column>
      <template v-if="contestTypeStr == '复合面' || contestTypeStr == '窗框'">
        <el-table-column
          v-if="showcolumn('测试面',1)" 
          sortable="custom"
          key="18"
          prop="surfaceType"
          label="测试面"
        ></el-table-column>
      </template>
    <template v-if="contestTypeStr == 'all' || (contestTypeStr!='控光点光源' && contestTypeStr!='不控光点光源' && contestTypeStr!='远视点光源')">
      <el-table-column
        v-if="showcolumn('平均亮度',1)" 
        sortable="custom"
        key="19"
        prop="lightnessAve"
        label="平均亮度"
        width="110"
      >
        <template slot-scope="scope">
          {{scope.row.lightnessAve}}
          <span v-if="scope.row.lightnessAve != null">cd/㎡</span>
        </template>
      </el-table-column>
      <el-table-column
        v-if="showcolumn('最大亮度',1)" 
        sortable="custom"
        key="20"
        prop="lightnessMax"
        label="最大亮度"
        width="110"
      >
        <template slot-scope="scope">
          {{scope.row.lightnessMax}}
          <span v-if="scope.row.lightnessMax != null">cd/㎡</span>
        </template>
      </el-table-column>
      <el-table-column
        v-if="showcolumn('最小亮度',1)" 
        sortable="custom"
        key="21"
        prop="lightness"
        label="最小亮度"
        width="110"
      >
        <template slot-scope="scope">
          {{scope.row.lightness}}
          <span v-if="scope.row.lightness != null">cd/㎡</span>
        </template>
      </el-table-column>
      <el-table-column
        v-if="showcolumn('均匀度',1)" 
        sortable="custom"
        key="22"
        prop="evenness"
        label="均匀度"
        width="120"
      >
        <template slot-scope="scope">
          <span
            v-show="scope.row.evenness != null && scope.row.evenness != ''"
          >{{scope.row.evenness}}</span>
        </template>
      </el-table-column>
      <el-table-column
        v-if="showcolumn('a点亮度',1)" 
        sortable="custom"
        key="23"
        prop="brightnessA"
        label="a点亮度"
        width="120"
      >
        <template slot-scope="scope">
          <span v-if="scope.row.brightnessA != null">{{scope.row.brightnessA}} cd/㎡</span>
        </template>
      </el-table-column>
      <el-table-column
        v-if="showcolumn('b点亮度',1)"
        sortable="custom"
        key="24"
        prop="brightnessB"
        label="b点亮度"
        width="120"
      >
        <template slot-scope="scope">
          <span v-if="scope.row.brightnessB != null">{{scope.row.brightnessB}} cd/㎡</span>
        </template>
      </el-table-column>
      <el-table-column
        v-if="showcolumn('c点亮度',1)" 
        sortable="custom"
        key="25"
        prop="brightnessC"
        label="c点亮度"
        width="120"
      >
        <template slot-scope="scope">
          <span v-if="scope.row.brightnessC != null">{{scope.row.brightnessC}} cd/㎡</span>
        </template>
      </el-table-column>

    </template>
      <template v-if="contestTypeStr == 'all' || contestTypeStr=='控光点光源'">
        <el-table-column prop="lightIntensity1" label="0°"  sortable="custom"
        v-if="showcolumn('0°',1)" >
          <template slot-scope="scope">
            {{scope.row.lightIntensity1}}
            <span v-if="scope.row.lightIntensity1 != null">cd</span>
          </template>
        </el-table-column>
        <el-table-column
        v-if="showcolumn('上30°',1)" 
          sortable="custom"
          key="26"
          prop="lightIntensity6"
          label="上30°"
          width="110"
        >
          <template slot-scope="scope">
            {{scope.row.lightIntensity6}}
            <span v-if="scope.row.lightIntensity6 != null">cd</span>
          </template>
        </el-table-column>
        <el-table-column
        v-if="showcolumn('下60°',1)" 
          sortable="custom"
          key="27"
          prop="lightIntensity4"
          label="下60°"
          width="110"
        >
          <template slot-scope="scope">
            {{scope.row.lightIntensity4}}
            <span v-if="scope.row.lightIntensity4 != null">cd</span>
          </template>
        </el-table-column>
        <el-table-column
        v-if="showcolumn('左60°',1)" 
          sortable="custom"
          key="28"
          prop="lightIntensity5"
          label="左60°"
          width="110"
        >
          <template slot-scope="scope">
            {{scope.row.lightIntensity5}}
            <span v-if="scope.row.lightIntensity5 != null">cd</span>
          </template>
        </el-table-column>
        <el-table-column
        v-if="showcolumn('右60°',1)" 
          sortable="custom"
          key="29"
          prop="lightIntensity2"
          label="右60°"
          width="110"
        >
          <template slot-scope="scope">
            {{scope.row.lightIntensity2}}
            <span v-if="scope.row.lightIntensity2 != null">cd</span>
          </template>
        </el-table-column>
      </template>
      <template v-if="contestTypeStr == 'all' || contestTypeStr=='不控光点光源'" width='110'>
        <el-table-column prop="lightIntensity1" label="0°"  sortable="custom"
        v-if="showcolumn('0°',1)" >
          <template slot-scope="scope">
            {{scope.row.lightIntensity1}}
            <span v-if="scope.row.lightIntensity1 != null">cd</span>
          </template>
        </el-table-column>
        <el-table-column
        v-if="showcolumn('上60°',1)" 
          sortable="custom"
          key="30"
          prop="lightIntensity8"
          label="上60°"
          width="110"
        >
          <template slot-scope="scope">
            {{scope.row.lightIntensity8}}
            <span v-if="scope.row.lightIntensity8 != null">cd</span>
          </template>
        </el-table-column>
        <el-table-column
        
        v-if="showcolumn('下60°',1)" 
          sortable="custom"
          key="31"
          prop="lightIntensity4"
          label="下60°"
          width="110"
        >
          <template slot-scope="scope">
            {{scope.row.lightIntensity4}}
            <span v-if="scope.row.lightIntensity4 != null">cd</span>
          </template>
        </el-table-column>
        <el-table-column
        
        v-if="showcolumn('左60°',1)" 
          sortable="custom"
          key="32"
          prop="lightIntensity5"
          label="左60°"
          width="110"
        >
          <template slot-scope="scope">
            {{scope.row.lightIntensity5}}
            <span v-if="scope.row.lightIntensity5 != null">cd</span>
          </template>
        </el-table-column>
        <el-table-column
        
        v-if="showcolumn('右60°',1)" 
          sortable="custom"
          key="33"
          prop="lightIntensity2"
          label="右60°"
          width="110"
        >
          <template slot-scope="scope">
            {{scope.row.lightIntensity2}}
            <span v-if="scope.row.lightIntensity2 != null">cd</span>
          </template>
        </el-table-column>
      </template>
      <template v-if="contestTypeStr == 'all' || contestTypeStr=='远视点光源'">
        <el-table-column prop="lightIntensity6" label="上30°"  sortable="custom"
        v-if="showcolumn('上30°',1)" >
          <template slot-scope="scope">
            {{scope.row.lightIntensity6}}
            <span v-if="scope.row.lightIntensity6 != null">cd</span>
          </template>
        </el-table-column>
        <el-table-column
        v-if="showcolumn('下45°',1)" 
          sortable="custom"
          key="34"
          prop="lightIntensity3"
          label="下45°"
          width="110"
        >
          <template slot-scope="scope">
            {{scope.row.lightIntensity3}}
            <span v-if="scope.row.lightIntensity3 != null">cd</span>
          </template>
        </el-table-column>
        <el-table-column
        v-if="showcolumn('下10°',1)" 
          sortable="custom"
          key="35"
          prop="lightIntensity7"
          label="下10°"
          width="110"
        >
          <template slot-scope="scope">
            {{scope.row.lightIntensity7}}
            <span v-if="scope.row.lightIntensity7 != null">cd</span>
          </template>
        </el-table-column>
        <el-table-column
        v-if="showcolumn('下10° 左60°',1)" 
          sortable="custom"
          key="36"
          prop="lightIntensity9"
          label="下10° 左60°"
          width="130"
        >
          <template slot-scope="scope">
            {{scope.row.lightIntensity9}}
            <span v-if="scope.row.lightIntensity9 != null">cd</span>
          </template>
        </el-table-column>
        <el-table-column
        
        v-if="showcolumn('下10° 右60°',1)" 
          sortable="custom"
          key="37"
          prop="lightIntensity10"
          label="下10° 右60°"
          width="130"
        >
          <template slot-scope="scope">
            {{scope.row.lightIntensity10}}
            <span v-if="scope.row.lightIntensity10 != null">cd</span>
          </template>
        </el-table-column>
      </template>
      <el-table-column v-if="showcolumn('光源类型',2)" key="36" prop="dictIdLitype" label="光源类型"></el-table-column>
      <el-table-column
        v-if="showcolumn('标称功率',2)" 
        sortable="custom"
        key="38"
        prop="lumPower"
        label="标称功率"
      >
        <template slot-scope="scope">
          <span v-if="scope.row.lumPower != null">{{scope.row.lumPower}}W</span>
        </template>
      </el-table-column>
      <el-table-column
      v-if="showcolumn('标称色温',2)"
        sortable="custom"
        key="39"
        prop="lumColorTempe"
        label="标称色温"
      >
        <template slot-scope="scope">
          <span v-if="scope.row.lumColorTempe != null">{{scope.row.lumColorTempe}}K</span>
        </template>
      </el-table-column>
      <el-table-column v-if="showcolumn('标称光束角',2)" key="39" prop="lumAngle" label="标称光束角" width="100">
        <template slot-scope="scope">
          <span v-if="scope.row.lumAngle != null">{{scope.row.lumAngle}}</span>
        </template>
      </el-table-column>
      <el-table-column
      v-if="showcolumn('标称电压',2)" 
        sortable="custom"
        key="40"
        prop="lumVoltage"
        label="标称电压"
      >
        <template slot-scope="scope">
          <span v-if="scope.row.lumVoltage != null">{{scope.row.lumVoltage}}V</span>
        </template>
      </el-table-column>
      <el-table-column
      v-if="showcolumn('灯具尺寸',2)" key="41"
        prop="longNs"
        label="灯具尺寸"
      >
        <template slot-scope="scope">
          <template v-if="scope.row.longNs != null && scope.row.heightNs != null">
            <span v-show="scope.row.widthNs == null">Φ</span>
            <span v-show="scope.row.longNs != null">{{scope.row.longNs}}</span>
            <span v-show="scope.row.widthNs != null">* {{scope.row.widthNs}}</span>
            <span v-show="scope.row.heightNs != null">
              *
              <span v-show="scope.row.widthNs == null">H</span>
              {{scope.row.heightNs}}
            </span>
            mm
          </template>
        </template>
      </el-table-column>
       <el-table-column
      v-if="showcolumn('实测色温',3)" 
        sortable
        key="42"
        prop="colorTempe"
        label="实测色温"
      >
        <template slot-scope="scope">
          <span v-if="scope.row.colorTempe != null && scope.row.colorTempe != ''">
            {{scope.row.colorTempe}}
            <span v-if="scope.row.colorTempe >= 1000">K</span>
            <span v-else>nm</span>
          </span>
        </template>
      </el-table-column>
      <el-table-column
        v-if="showcolumn('灯具长',2)"
        sortable
        key="43"
        prop="longNs"
        label="灯具长"
      >
        <template slot-scope="scope">
          <span v-show="scope.row.longNs != null">{{scope.row.longNs}} mm</span>
        </template>
      </el-table-column>
      <el-table-column
        v-if="showcolumn('灯具宽',2)" 
        sortable
        key="44"
        prop="widthNs"
        label="灯具宽"
      >
        <template slot-scope="scope">
          <span v-show="scope.row.widthNs != null">{{scope.row.widthNs}} mm</span>
        </template>
      </el-table-column>
      <el-table-column
        v-if="showcolumn('灯具高',2)" 
        sortable="custom"
        key="45"
        prop="heightNs"
        label="灯具高"
      >
        <template slot-scope="scope">
          <span v-show="scope.row.heightNs != null">{{scope.row.heightNs}} mm</span>
        </template>
      </el-table-column>
      <el-table-column
        v-if="showcolumn('支架高',2)" 
        sortable="custom"
        key="46"
        prop="zjHeight"
        label="支架高"
      ></el-table-column>
      <el-table-column
        v-if="showcolumn('挡光板高',2)"
        sortable="custom"
        key="47"
        prop="dbHeight"
        label="挡光板高"
      ></el-table-column>
      <el-table-column
      
      v-if="showcolumn('功率因数',3)"
        sortable="custom"
        key="48"
        prop="powerFactor"
        label="功率因数"
      ></el-table-column>
      <el-table-column
      
      v-if="showcolumn('实测电压',3)" 
        sortable="custom"
        key="49"
        prop="voltage"
        label="实测电压"
      >
        <template slot-scope="scope">
          <span v-if="scope.row.voltage != null">{{scope.row.voltage}}V</span>
        </template>
      </el-table-column>
      <!-- <el-table-column
      v-if="showcolumn('实测色温',3)" key="3"
        sortable="custom"
        prop="colorTempe"
        label="实测色温"
      >
        <template slot-scope="scope">
          <span v-if="scope.row.colorTempe != null && scope.row.colorTempe != ''">
            {{scope.row.colorTempe}}
            <span v-if="scope.row.colorTempe >= 1000">K</span>
            <span v-else>nm</span>
          </span>
        </template>
      </el-table-column> -->
      <el-table-column
      v-if="showcolumn('色容差',3)" 
        sortable="custom"
        key="50"
        prop="sdcm"
        label="色容差"
      >
        <template slot-scope="scope">
          {{scope.row.sdcm}}
          <span v-if="scope.row.sdcm != null">SDCM</span>
        </template>
      </el-table-column>
      <el-table-column
      v-if="showcolumn('Ra',3)" 
        sortable="custom"
        key="51"
        prop="colorXszs"
        label="Ra"
      ></el-table-column>
      <el-table-column
      v-if="showcolumn('R9',3)" 
        sortable="custom"
        key="52"
        prop="colorXszsR9"
        label="R9"
      ></el-table-column>
      <el-table-column
      v-if="showcolumn('光通量',3)" 
        sortable="custom"
        key="53"
        prop="opticGtl"
        label="光通量"
      >
        <template slot-scope="scope">
          {{scope.row.opticGtl}}
          <span v-if="scope.row.opticGtl != null">lm</span>
        </template>
      </el-table-column>
      <el-table-column
        v-if="showcolumn('参考价',2)" 
        sortable="custom"
        key="54"
        prop="authorizedPrice"
        label="参考价"
        width="90"
      >
        <template slot-scope="scope">
          <span v-if="scope.row.authorizedPrice == null || scope.row.authorizedPrice=='' || scope.row.authorizedPrice == '0'">面议</span>
          <span v-else>{{scope.row.authorizedPrice}}元</span>
        </template>
      </el-table-column>

      <el-table-column v-if="sourceType == 1" prop="list13" width="120" fixed="right">
        <template slot="header">操作</template>
        <template slot-scope="scope">
          <div class="btns_S">
            <div class="BoxTable">
              <div class="BoxCell">
                <span class="btn2" @click.stop="contrast_single(scope.row)">
                  <el-tooltip content="加入对比" placement="top">
                    <img src="@/assets/images/jiaru_03.png" alt />
                  </el-tooltip>
                </span>
                <span class="btn2" @click.stop="clickRow(scope.row)">
                  <el-tooltip content="数据详情" placement="top">
                    <img src="@/assets/images/xiangqing_05.png" alt />
                  </el-tooltip>
                </span>
                <span class="btn2" v-show="scope.row.isPilotLamp == 1">
                  <el-tooltip content="一键试灯" placement="top">
                    <img src="@/assets/images/shideng_07.png" alt />
                  </el-tooltip>
                </span>
                <!-- <span class="btn2">
                               <el-tooltip content="Top center" placement="top">
                               <img src="@/assets/images/shoucang_09.png" alt="">
                              </el-tooltip>
                </span>-->
              </div>
            </div>
          </div>
        </template>
      </el-table-column>
    </el-table>

    
    <!--查看图片 -->
    <el-dialog :visible.sync="showPic" v-dialogDrag custom-class="imgsAMG dee">
      <span>
        <img :src="showPicUrl" />
      </span>
    </el-dialog>

    <!--列表现实项弹窗 -->
    <el-dialog
      :visible.sync="showListShowHideSetDiv"
      v-dialogDrag
      custom-class="dynamic-class list_SAS"
    >
      <div class="tp">选择设置项包含的信息</div>
      <div class="contcheck">
        <div v-show="sourceType == 1" class="tishix">最多只能显示12项!</div>
        <el-form>
          <el-form-item>
            <div class="cont">
              <div class="title" style="font-size:20px">应用参数</div>
              <div class="conts">
                <div
                  class="li_list"
                  v-for="(item,index) in columnShowHideList1"
                  :key="index"
                  @click="changeColumnSH1(index,item)"
                  style="cursor:pointer"
                >
                  <input type="checkbox" :id="'checkbox_'+index" :checked="item.value ? 'checked' : ''" />
                  <span>{{item.label}}</span>
                </div>
              </div>
            </div>
            <div class="cont">
              <div class="title" style="font-size:20px">设备参数</div>
              <div class="conts">
                <div
                  class="li_list"
                  v-for="(item,index) in columnShowHideList2"
                  :key="index"
                  @click="changeColumnSH2(index,item)"
                  style="cursor:pointer"
                >
                  <input type="checkbox" :id="'checkbox2_'+index" :checked="item.value ? 'checked' : ''" />
                  <span>{{item.label}}</span>
                </div>
              </div>
            </div>
            <div class="cont">
              <div class="title" style="font-size:20px">实测参数</div>
              <div class="conts">
                <div
                  class="li_list"
                  v-for="(item,index) in columnShowHideList3"
                  :key="index"
                  @click="changeColumnSH3(index,item)"
                  style="cursor:pointer"
                >
                  <input type="checkbox" :id="'checkbox3_'+index" :checked="item.value ? 'checked' : ''" />
                  <span>{{item.label}}</span>
                </div>
              </div>
            </div>
            <div style="clear:both" class="btn">
              <el-button
                style="width:100px;padding:10px"
                type="primary"
                @click="showListShowHideSetDiv = false"
              >确定</el-button>
            </div>
          </el-form-item>
        </el-form>
      </div>
    </el-dialog>


  </div>
</template>
<script>
import _ from "lodash";
export default {
  data() {
    return {
      showListShowHideSetDiv: false,
      tableHeightss:false,
      tableData: [],
      tabData: [],
      totalCount: 0,
      request: {},
      sortRule: { prop: null, order: null },
      sourceType: 2,
      showPic: false, //查看图片
      showPicUrl: "", //图片地址
      contestTypeStr: "",
      columnShowHideList1: [],
      columnShowHideList2: [],
      columnShowHideList3: [],
      columnShowHideList1All: [
        //应用参数 全部 默认
        {
          label: "应用类型",
          value: false
        },
        {
          label: "H",
          value: false,
          onlyShow: [
            "洗墙",
            "复合面",
            "柱子",
            "瓦楞",
            "窗框",
            "单侧导光",
            "双侧导光",
            "光电玻璃",
            "自发光点"
          ]
        },
        {
          label: "W",
          value: false
        },
        {
          label: "W1",
          value: false,
          onlyShow: ["正投", "复合面"]
        },
        {
          label: "W2",
          value: false,
          onlyShow: ["复合面"]
        },
        {
          label: "D",
          value: false,
          onlyShow: [
            "洗墙",
            "复合面",
            "柱子",
            "瓦楞",
            "窗框",
            "单侧导光",
            "双侧导光",
            "光电玻璃",
            "自发光点"
          ]
        },
        {
          label: "测试角度",
          value: false
        },
        {
          label: "平均亮度",
          value: true,
          onlyShow: [
            "正投",
            "洗墙",
            "复合面",
            "柱子",
            "瓦楞",
            "窗框",
            "单侧导光",
            "双侧导光",
            "光电玻璃",
            "自发光点"
          ]
        },
        {
          label: "最大亮度",
          value: true,
          onlyShow: [
            "正投",
            "洗墙",
            "复合面",
            "柱子",
            "瓦楞",
            "窗框",
            "单侧导光",
            "双侧导光",
            "光电玻璃",
            "自发光点"
          ]
        },
        {
          label: "最小亮度",
          value: true,
          onlyShow: [
            "正投",
            "洗墙",
            "复合面",
            "柱子",
            "瓦楞",
            "窗框",
            "单侧导光",
            "双侧导光",
            "光电玻璃",
            "自发光点"
          ]
        },
        {
          label: "均匀度",
          value: true,
          onlyShow: [
            "正投",
            "洗墙",
            "复合面",
            "柱子",
            "瓦楞",
            "窗框",
            "单侧导光",
            "双侧导光",
            "光电玻璃",
            "自发光点"
          ]
        },
        {
          label: "a点亮度",
          value: false,
          onlyShow: ["正投"]
        },
        {
          label: "b点亮度",
          value: false,
          onlyShow: ["正投"]
        },
        {
          label: "c点亮度",
          value: false,
          onlyShow: ["正投"]
        },
        {
          label: "0°",
          value: true,
          onlyShow: ["控光点光源、不控光点光源"]
        },
        {
          label: "上30°",
          value: true,
          onlyShow: ["控光点光源、不控光点光源"]
        },
        {
          label: "上60°",
          value: true,
          onlyShow: ["不控光点光源"]
        },
        {
          label: "下60°",
          value: true,
          onlyShow: ["控光点光源、不控光点光源"]
        },
        {
          label: "左60°",
          value: true,
          onlyShow: ["控光点光源、不控光点光源"]
        },
        {
          label: "右60°",
          value: true,
          onlyShow: ["控光点光源、不控光点光源"]
        },
        {
          label: "下45°",
          value: true,
          onlyShow: ["远视点光源"]
        },
        {
          label: "下10°",
          value: true,
          onlyShow: ["远视点光源"]
        },
        {
          label: "下10° 左60°",
          value: true,
          onlyShow: ["远视点光源"]
        },
        {
          label: "下10° 右60°",
          value: true,
          onlyShow: ["远视点光源"]
        },
        {
          label: "伪色图",
          value: true,
          onlyShow: [
            "正投",
            "洗墙",
            "复合面",
            "柱子",
            "瓦楞",
            "窗框",
            "单侧导光",
            "双侧导光",
            "光电玻璃",
            "自发光点"
          ]
        },
        {
          label: "效果图",
          value: true,
          onlyShow: [
            "正投",
            "洗墙",
            "复合面",
            "柱子",
            "瓦楞",
            "窗框",
            "单侧导光",
            "双侧导光",
            "光电玻璃",
            "自发光点"
          ]
        },
        {
          label: "配光曲线图",
          value: true
        },
        {
          label: "检测模式",
          value: false
        },
        {
          label:'测试面',
          value:false,
          onlyShow:[
            "复合面",
            "窗框"
          ]
        }
      ],
      columnShowHideList2All: [
        //标称参数 全部 默认
        {
          label: "灯具类型",
          value: true
        },
        {
          label: "光源类型",
          value: false
        },
        {
          label: "品牌",
          value: true
        },
        {
          label: "标称功率",
          value: false
        },
        {
          label: "标称色温",
          value: false
        },
        {
          label: "标称光束角",
          value: false
        },
        {
          label: "标称电压",
          value: false
        },
        {
          label: "灯具尺寸",
          value: false
        },
        {
          label: "灯具长",
          value: false,
          onlyShow:['all']
        },
        {
          label: "灯具宽",
          value: false,
          onlyShow:['all']
        },
        {
          label: "灯具高",
          value: false,
          onlyShow:['all']
        },
        {
          label: "支架高",
          value: false
        },
        {
          label: "挡光板高",
          value: false
        },
        {
          label: "灯具图",
          value: true
        },
        {
          label: "参考价",
          value: true
        }
      ],
      columnShowHideList3All: [
        //实测参数 全部 默认
        {
          label: "实测功率",
          value: true
        },
        {
          label: "功率因数",
          value: false
        },
        {
          label: "实测电压",
          value: false
        },
        {
          label: "实测色温",
          value: false,
          onlyShow:['all']
        },
        {
          label: "色容差",
          value: false
        },
        {
          label: "Ra",
          value: false
        },
        {
          label: "R9",
          value: false
        },
        {
          label: "光通量",
          value: false
        },
        {
          label: "实测光束角",
          value: true
        }
      ]
    };
  },
  mounted(){
      this.$emit('tableOver');
      this.$nextTick(function () {
                   this.tableHeightss = window.innerHeight - 340;
                   let self = this;
                    window.onresize = function() {
                        self.tableHeightss = window.innerHeight - 340
                    }
      })
      if(this.contestTypeStr == 'all'){
        this.allKeysShowHide();
      }
  },
  methods: {
    settableCheckbox(val){
      console.log(val)
      this.$emit("settableCheckbox",val)
    },

        checkSelectable(row){
            return row.surfaceType != "B"
        },
    showcolumn(name,type){
      var item = undefined
      if(type == 1){
        var item = _.find(this.columnShowHideList1All,function(p){return p.label == name})
      }else if (type == 2){
        var item = _.find(this.columnShowHideList2All,function(p){return p.label == name})
      }else if (type == 3){
        var item = _.find(this.columnShowHideList3All,function(p){return p.label == name})
      }
      // if(item.onlyShow != null && item.onlyShow == this.contestTypeStr &&  this.contestTypeStr == 'all'){
      //   return true;
      // }
      // else 
      if(item != undefined){
        return item.value
      }
      return false
    },
    search(sourceType, contestTypeStr, request) {
      this.sourceType = sourceType;
      this.contestTypeStr = contestTypeStr;
      this.request = request;
      this.filterColumn();
      this.innerSearch()
    },
    innerSearch(){
      let self = this
      this.$http.postObj("/api/contests/list", this.request, function(res) {
        self.tableData = res.data.rows;
        self.tabData = res.data.rows;
        self.totalCount = res.data.total;
        var data ={
          tableData: self.tableData,
          totalCount : self.totalCount
        }
        self.$emit("setTotalCount",data)
      });
    },
    searchWeight(sourceType,contestFrontId,request){
      this.sourceType = sourceType;
      let self = this
      this.request = request
      this.$http.postObj('/api/contests/weightList/'+contestFrontId,this.request,function(res){
          if(res != null && res.data != null){
            self.tableData = res.data.rows
            self.tabData = res.data.rows
            self.totalCount = res.data.total
          }else{
            self.tableData = []
            self.totalCount = 0
          }
          var data ={
            tableData: self.tableData,
            totalCount : self.totalCount
          }
          self.$emit("setTotalCount",data)
        })
    },
    viewPicture(url) {
      this.showPic = true;
      this.showPicUrl = url;
    },
    sortChange(item) {
      //如果不排序了，就恢复到最初的状态
      if (item.order == null) {
        delete this.request.sort
        delete this.request.order
        this.innerSearch();
        // this.tableData = this.tabData;
      } else {
        this.request.sort = item.prop;
        this.request.order = item.order == "ascending" ? "asc" : "desc";
        console.log(this.request.order)
        this.innerSearch();
      }
      this.sortRule.order = item.order;
      this.sortRule.prop = item.prop;
    },
    clickRow(item) {
      this.$emit("contrastShow",item)
    },
    contrast_single(item){
      this.$emit("contrast_single",item)
    },
    showSetDiv() {
      this.showListShowHideSetDiv = true;
    },
    refreshALlSerchKey(){
      this.columnShowHideList1All= [
        //应用参数 全部 默认
        {
          label: "应用类型",
          value: false
        },
        {
          label: "H",
          value: false,
          onlyShow: [
            "洗墙",
            "复合面",
            "柱子",
            "瓦楞",
            "窗框",
            "单侧导光",
            "双侧导光",
            "光电玻璃",
            "自发光点"
          ]
        },
        {
          label: "W",
          value: false
        },
        {
          label: "W1",
          value: false,
          onlyShow: ["正投", "复合面"]
        },
        {
          label: "W2",
          value: false,
          onlyShow: ["复合面"]
        },
        {
          label: "D",
          value: false,
          onlyShow: [
            "洗墙",
            "复合面",
            "柱子",
            "瓦楞",
            "窗框",
            "单侧导光",
            "双侧导光",
            "光电玻璃",
            "自发光点"
          ]
        },
        {
          label: "测试角度",
          value: false
        },
        {
          label: "平均亮度",
          value: true,
          onlyShow: [
            "正投",
            "洗墙",
            "复合面",
            "柱子",
            "瓦楞",
            "窗框",
            "单侧导光",
            "双侧导光",
            "光电玻璃",
            "自发光点"
          ]
        },
        {
          label: "最大亮度",
          value: true,
          onlyShow: [
            "正投",
            "洗墙",
            "复合面",
            "柱子",
            "瓦楞",
            "窗框",
            "单侧导光",
            "双侧导光",
            "光电玻璃",
            "自发光点"
          ]
        },
        {
          label: "最小亮度",
          value: true,
          onlyShow: [
            "正投",
            "洗墙",
            "复合面",
            "柱子",
            "瓦楞",
            "窗框",
            "单侧导光",
            "双侧导光",
            "光电玻璃",
            "自发光点"
          ]
        },
        {
          label: "均匀度",
          value: true,
          onlyShow: [
            "正投",
            "洗墙",
            "复合面",
            "柱子",
            "瓦楞",
            "窗框",
            "单侧导光",
            "双侧导光",
            "光电玻璃",
            "自发光点"
          ]
        },
        {
          label: "a点亮度",
          value: false,
          onlyShow: ["正投"]
        },
        {
          label: "b点亮度",
          value: false,
          onlyShow: ["正投"]
        },
        {
          label: "c点亮度",
          value: false,
          onlyShow: ["正投"]
        },
        {
          label: "0°",
          value: true,
          onlyShow: ["控光点光源、不控光点光源"]
        },
        {
          label: "上30°",
          value: true,
          onlyShow: ["控光点光源、不控光点光源"]
        },
        {
          label: "上60°",
          value: true,
          onlyShow: ["不控光点光源"]
        },
        {
          label: "下60°",
          value: true,
          onlyShow: ["控光点光源、不控光点光源"]
        },
        {
          label: "左60°",
          value: true,
          onlyShow: ["控光点光源、不控光点光源"]
        },
        {
          label: "右60°",
          value: true,
          onlyShow: ["控光点光源、不控光点光源"]
        },
        {
          label: "下45°",
          value: true,
          onlyShow: ["远视点光源"]
        },
        {
          label: "下10°",
          value: true,
          onlyShow: ["远视点光源"]
        },
        {
          label: "下10° 左60°",
          value: true,
          onlyShow: ["远视点光源"]
        },
        {
          label: "下10° 右60°",
          value: true,
          onlyShow: ["远视点光源"]
        },
        {
          label: "伪色图",
          value: true,
          onlyShow: [
            "正投",
            "洗墙",
            "复合面",
            "柱子",
            "瓦楞",
            "窗框",
            "单侧导光",
            "双侧导光",
            "光电玻璃",
            "自发光点"
          ]
        },
        {
          label: "效果图",
          value: true,
          onlyShow: [
            "正投",
            "洗墙",
            "复合面",
            "柱子",
            "瓦楞",
            "窗框",
            "单侧导光",
            "双侧导光",
            "光电玻璃",
            "自发光点"
          ]
        },
        {
          label: "配光曲线图",
          value: true
        },
        {
          label: "检测模式",
          value: false
        },
        {
          label:'测试面',
          value:false,
          onlyShow:[
            "复合面",
            "窗框"
          ]
        }
      ];
      this.columnShowHideList2All= [
        //标称参数 全部 默认
        {
          label: "灯具类型",
          value: true
        },
        {
          label: "光源类型",
          value: false
        },
        {
          label: "品牌",
          value: true
        },
        {
          label: "标称功率",
          value: false
        },
        {
          label: "标称色温",
          value: false
        },
        {
          label: "标称光束角",
          value: false
        },
        {
          label: "标称电压",
          value: false
        },
        {
          label: "灯具尺寸",
          value: false
        },
        {
          label: "灯具长",
          value: false,
          onlyShow:['all']
        },
        {
          label: "灯具宽",
          value: false,
          onlyShow:['all']
        },
        {
          label: "灯具高",
          value: false,
          onlyShow:['all']
        },
        {
          label: "支架高",
          value: false
        },
        {
          label: "挡光板高",
          value: false
        },
        {
          label: "灯具图",
          value: true
        },
        {
          label: "参考价",
          value: true
        }
      ];
      this.columnShowHideList3All= [
        //实测参数 全部 默认
        {
          label: "实测功率",
          value: true
        },
        {
          label: "功率因数",
          value: false
        },
        {
          label: "实测电压",
          value: false
        },
        {
          label: "实测色温",
          value: false,
          onlyShow:['all']
        },
        {
          label: "色容差",
          value: false
        },
        {
          label: "Ra",
          value: false
        },
        {
          label: "R9",
          value: false
        },
        {
          label: "光通量",
          value: false
        },
        {
          label: "实测光束角",
          value: true
        }
      ]
    },
    allKeysShowHide(){
        this.columnShowHideList1All = [
          //应用参数 全部 默认
          {
            label: "应用类型",
            value: false
          },
          {
            label: "H",
            value: false
          },
          {
            label: "W",
            value: false
          },
          {
            label: "W1",
            value: false
          },
          {
            label: "W2",
            value: false
          },
          {
            label: "D",
            value: false
          },
          {
            label: "测试角度",
            value: false
          },
          {
            label: "平均亮度",
            value: false,
          },
          {
            label: "最大亮度",
            value: false,
          },
          {
            label: "最小亮度",
            value: false,
          },
          {
            label: "均匀度",
            value: false
          },
          {
            label: "a点亮度",
            value: false
          },
          {
            label: "b点亮度",
            value: false
          },
          {
            label: "c点亮度",
            value: false
          },
          {
            label: "0°",
            value: false
          },
          {
            label: "上30°",
            value: false
          },
          {
            label: "上60°",
            value: false
          },
          {
            label: "下60°",
            value: false
          },
          {
            label: "左60°",
            value: false
          },
          {
            label: "右60°",
            value: false
          },
          {
            label: "下45°",
            value: false
          },
          {
            label: "下10°",
            value: false
          },
          {
            label: "下10° 左60°",
            value: false
          },
          {
            label: "下10° 右60°",
            value: false
          },
          {
            label: "伪色图",
            value: true
          },
          {
            label: "效果图",
            value: true
          },
          {
            label: "配光曲线图",
            value: false
          },
          {
            label: "检测模式",
            value: false
          },
          {
            label:'测试面',
            value:false
          }
        ];
        this.columnShowHideList1 = this.columnShowHideList1All
        this.columnShowHideList2All = [
          //标称参数 全部 默认
          {
            label: "灯具类型",
            value: true
          },
          {
            label: "光源类型",
            value: false
          },
          {
            label: "品牌",
            value: true
          },
          {
            label: "标称功率",
            value: false
          },
          {
            label: "标称色温",
            value: false
          },
          {
            label: "标称光束角",
            value: false
          },
          {
            label: "标称电压",
            value: false
          },
          {
            label: "灯具尺寸",
            value: false
          },
          {
            label: "灯具长",
            value: true,
            onlyShow:['all']
          },
          {
            label: "灯具宽",
            value: true,
            onlyShow:['all']
          },
          {
            label: "灯具高",
            value: true,
            onlyShow:['all']
          },
          {
            label: "支架高",
            value: false
          },
          {
            label: "挡光板高",
            value: false
          },
          {
            label: "灯具图",
            value: true
          },
          {
            label: "参考价",
            value: true
          }
        ];
        this.columnShowHideList2 = this.columnShowHideList2All
        this.columnShowHideList3All = [
          //实测参数 全部 默认
          {
            label: "实测功率",
            value: true
          },
          {
            label: "功率因数",
            value: false
          },
          {
            label: "实测电压",
            value: false
          },
          {
            label: "实测色温",
            value: true,
            onlyShow:['all']
          },
          {
            label: "色容差",
            value: false
          },
          {
            label: "Ra",
            value: false
          },
          {
            label: "R9",
            value: false
          },
          {
            label: "光通量",
            value: false
          },
          {
            label: "实测光束角",
            value: true
          }
        ]
        this.columnShowHideList3 = this.columnShowHideList3All
    },
    filterColumn() {
      if(this.contestTypeStr == 'all'){
        this.allKeysShowHide();
      }else{
        let self = this;

        var temp1 = [];
        for (var i = 0; i < this.columnShowHideList1All.length; i++) {
          var row = this.columnShowHideList1All[i];
          
          if (row.onlyShow) {
            var show = _.find(row.onlyShow, function(o) {
              return o == self.contestTypeStr;
            });
            if (show != undefined) {
              temp1.push(row);
            }
          } else {
            if(row.label=='配光曲线图'){
              console.log(row)
              if(self.contestTypeStr!='控光点光源' && self.contestTypeStr!='不控光点光源' && self.contestTypeStr!='远视点光源'){
                row.value=false
                temp1.push(row)
              }
            }else{
              temp1.push(row);
            }
          }
        }
        this.columnShowHideList1 = temp1;

        var temp2 = [];
        for (var i = 0; i < this.columnShowHideList2All.length; i++) {
          var row = this.columnShowHideList2All[i];
          if (row.onlyShow) {
            var show = _.find(row.onlyShow, function(o) {
              return o == self.contestTypeStr;
            });
            if (show != undefined) {
              temp2.push(row);
            }
          } else {
            temp2.push(row);
          }
        }
        this.columnShowHideList2 = temp2;

        var temp3 = [];
        for (var i = 0; i < this.columnShowHideList3All.length; i++) {
          var row = this.columnShowHideList3All[i];
          if (row.onlyShow) {
            var show = _.find(row.onlyShow, function(o) {
              return o == self.contestTypeStr;
            });
            if (show != undefined) {
              temp3.push(row);
            }
          } else {
            temp3.push(row);
          }
        }
        this.columnShowHideList3 = temp3;
      }
    },
    changeColumnSH1(index, item) {
      var total1 = _.sumBy(this.columnShowHideList1,function(o){return o.value})
      var total2 = _.sumBy(this.columnShowHideList2,function(o){return o.value})
      var total3 = _.sumBy(this.columnShowHideList3,function(o){return o.value})

      var total = total1+total2+total3
      if(!item.value && this.sourceType == 1){
        if(total < 12){
          item.value = !item.value;
        }else{
          var ckb = document.getElementById('checkbox_'+index)
          if(ckb.checked == true){
            ckb.checked = false
          }
          item.value = false
          this.$message({type: '提示',message: "最多只能展示12项！"});
        }
      }else{
        item.value = !item.value;
      }
    },
    changeColumnSH2(index, item) {
      var total1 = _.sumBy(this.columnShowHideList1,function(o){return o.value})
      var total2 = _.sumBy(this.columnShowHideList2,function(o){return o.value})
      var total3 = _.sumBy(this.columnShowHideList3,function(o){return o.value})

      var total = total1+total2+total3
      if(!item.value && this.sourceType == 1){
        if(total < 12){
          item.value = !item.value;
        }else{
          var ckb = document.getElementById('checkbox2_'+index)
          if(ckb.checked == true){
            ckb.checked = false
          }
          item.value = false
          this.$message({type: '提示',message: "最多只能展示12项！"});
        }
      }else{
        item.value = !item.value;
      }
    },
    changeColumnSH3(index, item) {
      var total1 = _.sumBy(this.columnShowHideList1,function(o){return o.value})
      var total2 = _.sumBy(this.columnShowHideList2,function(o){return o.value})
      var total3 = _.sumBy(this.columnShowHideList3,function(o){return o.value})

      var total = total1+total2+total3
      if(!item.value && this.sourceType == 1){
        if(total < 12){
          item.value = !item.value;
        }else{
          var ckb = document.getElementById('checkbox3_'+index)
          if(ckb.checked == true){
            ckb.checked = false
          }
          item.value = false
          this.$message({type: '提示',message: "最多只能展示12项！"});
        }
      }else{
        item.value = !item.value;
      }
    }
  }
};
</script>
<style rel="stylesheet/scss" lang="scss" >
.centerCont.customHtml{
     max-height: calc(100vh - 280px);
    max-height: -webkit-calc(100vh - 280px);
}
.effx .has-gutter th{
    background-color: #f6f7fb;
    color: #555555;
    text-align: center;
}
</style>